package com.demo.springboot;

import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * 定义监听器
 */
// @Component // 方法②
public class MyApplicationListener implements ApplicationListener<MyApplicationEvent> {
    @Override
    public void onApplicationEvent(MyApplicationEvent event) {
        System.out.println("收到事件："+event.getClass());
    }
}
